<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/Ctxt.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Ctxt.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_ctxt_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_CTXT_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_CTXT_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="preprocessor">#include &lt;cfloat&gt;</span> <span class="comment">// DBL_MAX</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_double_c_r_t_8h.html">helib/DoubleCRT.h</a>&gt;</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="api_attributes_8h.html">helib/apiAttributes.h</a>&gt;</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="keyword">struct </span>CKKS;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="keyword">struct </span>BGV;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classhelib_1_1_ptxt.html">   66</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_ptxt.html">Ptxt</a>;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a>;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html">   77</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;{</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;  <span class="keywordtype">long</span> powerOfS, powerOfX, secretKeyID;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#a946041a62ae7a72c3fc188af3fd608b8">   82</a></span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#a5fc29647d9f2c82246d6c7561b03e57c">   84</a></span>&#160;  <a class="code" href="classhelib_1_1_s_k_handle.html#a5fc29647d9f2c82246d6c7561b03e57c">SKHandle</a>(<span class="keywordtype">long</span> newPowerOfS = 0, <span class="keywordtype">long</span> newPowerOfX = 1, <span class="keywordtype">long</span> newSecretKeyID = 0)</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  {</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    powerOfS = newPowerOfS;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    powerOfX = newPowerOfX;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    secretKeyID = newSecretKeyID;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  }</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#ab3db0c0376d013b4d9760f979664b199">   92</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_s_k_handle.html#ab3db0c0376d013b4d9760f979664b199">setBase</a>(<span class="keywordtype">long</span> newSecretKeyID = -1)</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    powerOfS = 1;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    powerOfX = 1;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keywordflow">if</span> (newSecretKeyID &gt;= 0)</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;      secretKeyID = newSecretKeyID;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  }</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#aff3f98d8320f01259907d99b9d1e82b4">  101</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_s_k_handle.html#aff3f98d8320f01259907d99b9d1e82b4">isBase</a>(<span class="keywordtype">long</span> ofKeyID = 0)<span class="keyword"> const</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <span class="comment">// If ofKeyID&lt;0, only check that this is base of some key,</span></div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="comment">// otherwise check that this is base of the given key</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">return</span> powerOfS == 1 &amp;&amp; powerOfX == 1 &amp;&amp;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;           (ofKeyID &lt; 0 || secretKeyID == ofKeyID);</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;  }</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#ac8441b0140bd6652880eb1461ebc0278">  110</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_s_k_handle.html#ac8441b0140bd6652880eb1461ebc0278">setOne</a>(<span class="keywordtype">long</span> newSecretKeyID = -1)</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    powerOfS = 0;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    powerOfX = 1;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordflow">if</span> (newSecretKeyID &gt;= 0)</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;      secretKeyID = newSecretKeyID;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  }</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#abcbc38129fd9f8a57a51738a4bf95497">  119</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_s_k_handle.html#abcbc38129fd9f8a57a51738a4bf95497">isOne</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> powerOfS == 0; }</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#af6fe46226ec3a104b4ccbeffb421f8ae">  121</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_s_k_handle.html#af6fe46226ec3a104b4ccbeffb421f8ae">operator==</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; other)<span class="keyword"> const</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordflow">if</span> (powerOfS == 0 &amp;&amp; other.powerOfS == 0)</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <span class="keywordflow">return</span> powerOfS == other.powerOfS &amp;&amp; powerOfX == other.powerOfX &amp;&amp;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;             secretKeyID == other.secretKeyID;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  }</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#ac47f7606f1c607f9505d7a7cd973f114">  130</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_s_k_handle.html#ac47f7606f1c607f9505d7a7cd973f114">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == other); }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  <span class="comment">/* access functions */</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#a0fc34851d7423c914dc3277c92631b16">  134</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_s_k_handle.html#a0fc34851d7423c914dc3277c92631b16">getPowerOfS</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> powerOfS; }</div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#a905000baeb7e543bcf5dfddd86165807">  135</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_s_k_handle.html#a905000baeb7e543bcf5dfddd86165807">getPowerOfX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> powerOfX; }</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#ac9ab3a9daba86ae6114c2aab1a7f9501">  136</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_s_k_handle.html#ac9ab3a9daba86ae6114c2aab1a7f9501">getSecretKeyID</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> secretKeyID; }</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="classhelib_1_1_s_k_handle.html#a597ac6729760ac1d7b3adc3fc09b4d81">  150</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_s_k_handle.html#a597ac6729760ac1d7b3adc3fc09b4d81">mul</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; b)</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;  {</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="comment">// If either of the inputs is one, the output equals to the other input</span></div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="keywordflow">if</span> (a.<a class="code" href="classhelib_1_1_s_k_handle.html#abcbc38129fd9f8a57a51738a4bf95497">isOne</a>()) {</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;      *<span class="keyword">this</span> = b;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;      <span class="keywordflow">return</span> (b.secretKeyID &gt;= 0);</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    }</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="keywordflow">if</span> (b.<a class="code" href="classhelib_1_1_s_k_handle.html#abcbc38129fd9f8a57a51738a4bf95497">isOne</a>()) {</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;      *<span class="keyword">this</span> = a;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;      <span class="keywordflow">return</span> (a.secretKeyID &gt;= 0);</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    }</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160; </div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordflow">if</span> (a.secretKeyID == -1 || b.secretKeyID == -1) {</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;      secretKeyID = -1; <span class="comment">// -1 will be used to indicate an &quot;error state&quot;</span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="keywordflow">if</span> (a.secretKeyID != b.secretKeyID) {</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;      secretKeyID = -1;</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    }</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    <span class="keywordflow">if</span> (a.powerOfX != b.powerOfX) {</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;      secretKeyID = -1;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    secretKeyID = a.secretKeyID;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    powerOfX = a.powerOfX;</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    powerOfS = a.powerOfS + b.powerOfS;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;  }</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;  <span class="keyword">friend</span> std::istream&amp; <a class="code" href="classhelib_1_1_s_k_handle.html#a749c2ed9522cd1b53b46f514c441be24">operator&gt;&gt;</a>(std::istream&amp; s, <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; handle);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160; </div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;  <span class="comment">// Raw IO</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_s_k_handle.html#a239df9f6664d3fba45ede21182471764">read</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_s_k_handle.html#a59ec48370cb48358715541436267182b">write</a>(std::ostream&amp; str) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;};</div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">  189</a></span>&#160;<span class="keyword">inline</span> std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; handle)</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;{</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;  <span class="keywordflow">return</span> s &lt;&lt; <span class="stringliteral">&quot;[&quot;</span> &lt;&lt; handle.<a class="code" href="classhelib_1_1_s_k_handle.html#a0fc34851d7423c914dc3277c92631b16">getPowerOfS</a>() &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; handle.<a class="code" href="classhelib_1_1_s_k_handle.html#a905000baeb7e543bcf5dfddd86165807">getPowerOfX</a>() &lt;&lt; <span class="stringliteral">&quot; &quot;</span></div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;           &lt;&lt; handle.<a class="code" href="classhelib_1_1_s_k_handle.html#ac9ab3a9daba86ae6114c2aab1a7f9501">getSecretKeyID</a>() &lt;&lt; <span class="stringliteral">&quot;]&quot;</span>;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;}</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160; </div>
<div class="line"><a name="l00202"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html">  202</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_ctxt_part.html">CtxtPart</a> : <span class="keyword">public</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;{</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00206"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">  206</a></span>&#160;  <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a> <a class="code" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">skHandle</a>; <span class="comment">// The secret-key polynomial corresponding to this part</span></div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt_part.html#ab476739ce019454ce6e5354c9b9c7406">operator==</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt_part.html">CtxtPart</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#a5621f300042d99495af1a676c475d066">  209</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt_part.html#a5621f300042d99495af1a676c475d066">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt_part.html">CtxtPart</a>&amp; other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == other); }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;  <span class="comment">// Constructors</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160; </div>
<div class="line"><a name="l00213"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#a65d605d7226b0c62b404ce12a8a15a5b">  213</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt_part.html#a65d605d7226b0c62b404ce12a8a15a5b">CtxtPart</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; _context, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s) : <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(_context, s)</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;  {</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <a class="code" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">skHandle</a>.<a class="code" href="classhelib_1_1_s_k_handle.html#ac8441b0140bd6652880eb1461ebc0278">setOne</a>();</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;  }</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160; </div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#adb900c0a87e917e75bdb04f213c8b8db">  218</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt_part.html#adb900c0a87e917e75bdb04f213c8b8db">CtxtPart</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; _context,</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;           <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s,</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;           <span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; otherHandle) :</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;      <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(_context, s), <a class="code" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">skHandle</a>(otherHandle)</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;  {}</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;  <span class="comment">// Copy constructors from the base class</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#a6cf5f4c1edebbebfabd947312781eb3a">  225</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_ctxt_part.html#a6cf5f4c1edebbebfabd947312781eb3a">CtxtPart</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; other) : <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(other)</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;  {</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    <a class="code" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">skHandle</a>.<a class="code" href="classhelib_1_1_s_k_handle.html#ac8441b0140bd6652880eb1461ebc0278">setOne</a>();</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;  }</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt_part.html#a785ba237b76cfff83d8e2fd4cd656359">  230</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt_part.html#a785ba237b76cfff83d8e2fd4cd656359">CtxtPart</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; other, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; otherHandle) :</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;      <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(other), <a class="code" href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">skHandle</a>(otherHandle)</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;  {}</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt_part.html#accbb202852a15b9c20dce44bc8943bae">read</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt_part.html#acf3c77ac71cea4aa9dcd9a76584e3552">write</a>(std::ostream&amp; str) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;};</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;std::istream&amp; <a class="code" href="namespacehelib.html#a84b37f68c4bdc42558ad0360b00984fb">operator&gt;&gt;</a>(std::istream&amp; s, CtxtPart&amp; p);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> CtxtPart&amp; p);</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160; </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;<span class="keyword">struct </span>ZeroCtxtLike_type</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;{}; <span class="comment">// used to select a constructor</span></div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;<span class="keyword">const</span> ZeroCtxtLike_type ZeroCtxtLike = ZeroCtxtLike_type();</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160; </div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html">  269</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a></div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;{</div>
<div class="line"><a name="l00271"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a09d29f59ac3fa73945a16931be4f756f">  271</a></span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a5b5d89141b4d68c0830b9fe4468ac8f7">  272</a></span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>;</div>
<div class="line"><a name="l00273"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#aece74568ce6fca0a4def01ee5e797a47">  273</a></span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_basic_automorph_precon.html">BasicAutomorphPrecon</a>;</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160; </div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context;      <span class="comment">// points to the parameters of this FHE instance</span></div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; pubKey;        <span class="comment">// points to the public encryption key;</span></div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;  std::vector&lt;CtxtPart&gt; parts; <span class="comment">// the ciphertext parts</span></div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;  <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a> primeSet; <span class="comment">// the primes relative to which the parts are defined</span></div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;  <span class="keywordtype">long</span> ptxtSpace;    <span class="comment">// plaintext space for this ciphertext (either p or p^r)</span></div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160; </div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;  <span class="comment">// a high-probability bound on the the noise magnitude</span></div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;  NTL::xdouble noiseBound;</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160; </div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;  <span class="keywordtype">long</span> intFactor; <span class="comment">// an integer factor to divide by on decryption (for BGV)</span></div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;  NTL::xdouble ratFactor; <span class="comment">// rational factor to divide on decryption (for CKKS)</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;  NTL::xdouble ptxtMag;   <span class="comment">// bound on the plaintext size (for CKKS)</span></div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160; </div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;  <span class="comment">// Create a tensor product of c1,c2. It is assumed that *this,c1,c2</span></div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;  <span class="comment">// are defined relative to the same set of primes and plaintext space,</span></div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;  <span class="comment">// and that *this DOES NOT point to the same object as c1,c2</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;  <span class="keywordtype">void</span> tensorProduct(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c1, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c2);</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160; </div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;  <span class="comment">// Add/subtract a ciphertext part to/from a ciphertext. These are private</span></div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;  <span class="comment">// methods, they cannot update the noiseBound so they must be called</span></div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;  <span class="comment">// from a procedure that will eventually update that estimate.</span></div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; operator-=(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt_part.html">CtxtPart</a>&amp; part)</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;  {</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    subPart(part);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;  }</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="namespacehelib.html#ac1a8de3a0f340ce6a600fa1da2233191">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt_part.html">CtxtPart</a>&amp; part)</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;  {</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    addPart(part);</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;  }</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160; </div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;  <span class="comment">// Procedural versions with additional parameter</span></div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;  <span class="keywordtype">void</span> subPart(<span class="keyword">const</span> CtxtPart&amp; part, <span class="keywordtype">bool</span> matchPrimeSet = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;  {</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    subPart(part, part.skHandle, matchPrimeSet);</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;  }</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;  <span class="keywordtype">void</span> addPart(<span class="keyword">const</span> CtxtPart&amp; part, <span class="keywordtype">bool</span> matchPrimeSet = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;  {</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;    addPart(part, part.skHandle, matchPrimeSet);</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;  }</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160; </div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;  <span class="keywordtype">void</span> subPart(<span class="keyword">const</span> DoubleCRT&amp; part,</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;               <span class="keyword">const</span> SKHandle&amp; handle,</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;               <span class="keywordtype">bool</span> matchPrimeSet = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;  {</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;    addPart(part, handle, matchPrimeSet, <span class="keyword">true</span>);</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;  }</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;  <span class="keywordtype">void</span> addPart(<span class="keyword">const</span> DoubleCRT&amp; part,</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;               <span class="keyword">const</span> SKHandle&amp; handle,</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;               <span class="keywordtype">bool</span> matchPrimeSet = <span class="keyword">false</span>,</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;               <span class="keywordtype">bool</span> negative = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;  <span class="comment">// Takes as arguments a ciphertext-part p relative to s&#39; and a key-switching</span></div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  <span class="comment">// matrix W = W[s&#39;-&gt;s], use W to switch p relative to (1,s), and add the</span></div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;  <span class="comment">// result to *this.</span></div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;  <span class="keywordtype">void</span> keySwitchPart(<span class="keyword">const</span> CtxtPart&amp; p, <span class="keyword">const</span> KeySwitch&amp; W);</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160; </div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;  <span class="comment">// internal procedure used in key-switching</span></div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;  <span class="keywordtype">void</span> keySwitchDigits(<span class="keyword">const</span> KeySwitch&amp; W, std::vector&lt;DoubleCRT&gt;&amp; digits);</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160; </div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;  <span class="keywordtype">long</span> getPartIndexByHandle(<span class="keyword">const</span> SKHandle&amp; handle)<span class="keyword"> const</span></div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; parts.size(); i++)</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;      <span class="keywordflow">if</span> (parts[i].skHandle == handle)</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;        <span class="keywordflow">return</span> i;</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;    <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;  }</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160; </div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;  <span class="comment">// Sanity-check: Check that prime-set is &quot;valid&quot;, i.e. that it</span></div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;  <span class="comment">// contains either all the special primes or none of them</span></div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;  <span class="keywordtype">bool</span> verifyPrimeSet() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160; </div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;  <span class="comment">// A private assignment method that does not check equality of context or</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;  <span class="comment">// public key, this is needed when we copy the pubEncrKey member between</span></div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;  <span class="comment">// different public keys.</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html#a6167385b97fec9383924ce1de0623447">Ctxt</a>&amp; privateAssign(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html#a6167385b97fec9383924ce1de0623447">Ctxt</a>&amp; other);</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160; </div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;  <span class="comment">// explicitly multiply intFactor by e, which should be</span></div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;  <span class="comment">// in the interval [0, ptxtSpace)</span></div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;  <span class="keywordtype">void</span> mulIntFactor(<span class="keywordtype">long</span> e);</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160; </div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;  <span class="comment">//__attribute__((deprecated))</span></div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_ctxt.html#a6167385b97fec9383924ce1de0623447">Ctxt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html#a09d29f59ac3fa73945a16931be4f756f">PubKey</a>&amp; newPubKey, <span class="keywordtype">long</span> newPtxtSpace = 0); <span class="comment">// constructor</span></div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160; </div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;  <span class="comment">// Default copy-constructor</span></div>
<div class="line"><a name="l00362"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a9755426e7ad503525a3f7ebd7fda001a">  362</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html#a9755426e7ad503525a3f7ebd7fda001a">Ctxt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other) = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160; </div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html#a6167385b97fec9383924ce1de0623447">Ctxt</a>(ZeroCtxtLike_type, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt);</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;  <span class="comment">// constructs a zero ciphertext with same public key and</span></div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;  <span class="comment">// plaintext space as ctxt</span></div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160; </div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a2a6c0076a639a07b64ca0836c6d2ba8f">DummyEncrypt</a>(<span class="keyword">const</span> NTL::ZZX&amp; ptxt, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160; </div>
<div class="line"><a name="l00373"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a42eabb3f49d284987f292904e347896f">  373</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a42eabb3f49d284987f292904e347896f">operator=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;  { <span class="comment">// public assignment operator</span></div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;context,</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;             &amp;other.context,</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;             <span class="stringliteral">&quot;Cannot assign Ctxts with different context&quot;</span>);</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;pubKey,</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;             &amp;other.pubKey,</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;             <span class="stringliteral">&quot;Cannot assign Ctxts with different pubKey&quot;</span>);</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    <span class="keywordflow">return</span> privateAssign(other);</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;  }</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160; </div>
<div class="line"><a name="l00384"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a84cb5f5d23fcb447ac18af18497570ef">  384</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#a84cb5f5d23fcb447ac18af18497570ef">operator==</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_ctxt.html#ac38e7805aad49feadfab6044a3b83c0b">equalsTo</a>(other); }</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ad761bbf3977b408b91b3e9f1f9d54243">  385</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#ad761bbf3977b408b91b3e9f1f9d54243">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !<a class="code" href="classhelib_1_1_ctxt.html#ac38e7805aad49feadfab6044a3b83c0b">equalsTo</a>(other); }</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160; </div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;  <span class="comment">// a procedural variant with an additional parameter</span></div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#ac38e7805aad49feadfab6044a3b83c0b">equalsTo</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other, <span class="keywordtype">bool</span> comparePkeys = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160; </div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;  <span class="comment">// Encryption and decryption are done by the friends [Pub|Sec]Key</span></div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a0d8950ecc7af034b33ac8f5a247ef5ea">negate</a>();</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160; </div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;  <span class="comment">// Add/subtract another ciphertext</span></div>
<div class="line"><a name="l00397"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a8e117ac77007f17b33985d1b12da1ca8">  397</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a8e117ac77007f17b33985d1b12da1ca8">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;  {</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#ab6d6ddcfda3e0e00c821e9c30cc933be">addCtxt</a>(other);</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;  }</div>
<div class="line"><a name="l00402"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ad791bfc3ca7b717e5c961992e264d4ab">  402</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#ad791bfc3ca7b717e5c961992e264d4ab">operator-=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;  {</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#ab6d6ddcfda3e0e00c821e9c30cc933be">addCtxt</a>(other, <span class="keyword">true</span>);</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;  }</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ab6d6ddcfda3e0e00c821e9c30cc933be">addCtxt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other, <span class="keywordtype">bool</span> negative = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;  <span class="comment">// Multiply by another ciphertext</span></div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#afb098f38a18ec6de648acadb8265d9ba">multLowLvl</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other, <span class="keywordtype">bool</span> destructive = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00411"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">  411</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other)</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;  {</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#afb098f38a18ec6de648acadb8265d9ba">multLowLvl</a>(other);</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;  }</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a0378ed181a8f8d6a31f4717db37f3912">automorph</a>(<span class="keywordtype">long</span> k); <span class="comment">// Apply automorphism F(X) -&gt; F(X^k) (gcd(k,m)=1)</span></div>
<div class="line"><a name="l00417"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ae1a8692ddc6523e41a38cbc033e0798c">  417</a></span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#ae1a8692ddc6523e41a38cbc033e0798c">operator&gt;&gt;=</a>(<span class="keywordtype">long</span> k)</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;  {</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a0378ed181a8f8d6a31f4717db37f3912">automorph</a>(k);</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;  }</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a266574a060b91f68d54771b0b083d0ac">complexConj</a>(); <span class="comment">// Complex conjugate, same as automorph(m-1)</span></div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160; </div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ad7697bc94e5db93b5db7238fa6418d15">smartAutomorph</a>(<span class="keywordtype">long</span> k);</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;  <span class="comment">// Apply F(X)-&gt;F(X^k) followed by re-linearization. The automorphism is</span></div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;  <span class="comment">// possibly evaluated via a sequence of steps, to ensure that we can</span></div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;  <span class="comment">// re-linearize the result of every step.</span></div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160; </div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#af45e7cea4c25ed6252b5695f1686ea01">frobeniusAutomorph</a>(<span class="keywordtype">long</span> j);</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160; </div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;  <span class="comment">// Operators acting between ciphertexts and plaintext objects</span></div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160; </div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;  <span class="comment">// BGV case</span></div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;<span class="comment"></span>  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="namespacehelib.html#ac1a8de3a0f340ce6a600fa1da2233191">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;BGV&gt;</a>&amp; other);</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160; </div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; operator-=(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;BGV&gt;</a>&amp; other);</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160; </div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;BGV&gt;</a>&amp; other);</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160; </div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;  <span class="comment">// CKKS case</span></div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;<span class="comment"></span>  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="namespacehelib.html#ac1a8de3a0f340ce6a600fa1da2233191">operator+=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;CKKS&gt;</a>&amp; other);</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160; </div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; operator-=(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;CKKS&gt;</a>&amp; other);</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160; </div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">operator*=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;CKKS&gt;</a>&amp; other);</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160; </div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">operator*=</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly);</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160; </div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">operator*=</a>(<span class="keyword">const</span> <span class="keywordtype">long</span> scalar);</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160; </div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; dcrt, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160; </div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l00508"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ae1974d8eaedd9da6ef46ac38a4dbf740">  508</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ae1974d8eaedd9da6ef46ac38a4dbf740">addConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; ptxt)</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;  {</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(ptxt.<a class="code" href="classhelib_1_1_ptxt.html#a2856a44b1a4ed056b2ab25136572dc16">getPolyRepr</a>());</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;  }</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(<span class="keyword">const</span> NTL::ZZ&amp; c);</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(std::pair&lt;/*numerator=*/long, /*denominator=*/long&gt;);</div>
<div class="line"><a name="l00515"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a6662c3655bc718353a84832e6c7a6a41">  515</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a6662c3655bc718353a84832e6c7a6a41">addConstantCKKS</a>(<span class="keywordtype">double</span> x)</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;  { <span class="comment">// FIXME: not enough precision when x is large</span></div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;        <a class="code" href="namespacehelib.html#a03f697f7ff3bbb3d9d17f75d35946991">rationalApprox</a>(x, <span class="comment">/*denomBound=*/</span>1 &lt;&lt; <a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>().alMod.getR()));</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;  }</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; dcrt,</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;                       NTL::xdouble size = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;                       NTL::xdouble factor = NTL::xdouble(-1.0));</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly,</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;                       NTL::xdouble size = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;                       NTL::xdouble factor = NTL::xdouble(-1.0));</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(<span class="keyword">const</span> std::vector&lt;std::complex&lt;double&gt;&gt;&amp; ptxt);</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160; </div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;CKKS&gt;</a>&amp; ptxt);</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">addConstantCKKS</a>(<span class="keyword">const</span> NTL::ZZ&amp; c);</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160; </div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; dcrt, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; poly, <span class="keywordtype">double</span> size = -1.0);</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(<span class="keyword">const</span> NTL::ZZ&amp; c);</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160; </div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l00550"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a160e2585f4693920976a482f8ba4435d">  550</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a160e2585f4693920976a482f8ba4435d">multByConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; ptxt)</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;  {</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(ptxt.<a class="code" href="classhelib_1_1_ptxt.html#a2856a44b1a4ed056b2ab25136572dc16">getPolyRepr</a>());</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;  }</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160; </div>
<div class="line"><a name="l00556"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">  556</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(<span class="keywordtype">double</span> x)</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;  {</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    ratFactor /= x;</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;    ptxtMag *= std::abs(x);</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;  }</div>
<div class="line"><a name="l00561"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a8dcaea89cdce5bdc050c5327aa9394bc">  561</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a8dcaea89cdce5bdc050c5327aa9394bc">multByConstantCKKS</a>(std::pair&lt;long, long&gt; num) <span class="comment">// rational number</span></div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;  {</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(<span class="keywordtype">double</span>(num.first) / num.second);</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;  }</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160; </div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; dcrt,</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;                          NTL::xdouble size = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;                          NTL::xdouble factor = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;                          <span class="keywordtype">double</span> roundingErr = -1.0);</div>
<div class="line"><a name="l00570"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a079e2d2426c5076ef1c1e52882dc7ec3">  570</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a079e2d2426c5076ef1c1e52882dc7ec3">multByConstantCKKS</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly,</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;                          NTL::xdouble size = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;                          NTL::xdouble factor = NTL::xdouble(-1.0),</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;                          <span class="keywordtype">double</span> roundingErr = -1.0)</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;  {</div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;    <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a> dcrt(poly, context, primeSet);</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(dcrt, size, factor, roundingErr);</div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;  }</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160; </div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;  <span class="comment">// TODO: Ptxt: refactor into single function for getting the</span></div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;  <span class="comment">// std::vector&lt;cx_double&gt; repr of slots</span></div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;CKKS&gt;</a>&amp; ptxt);</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">multByConstantCKKS</a>(<span class="keyword">const</span> std::vector&lt;std::complex&lt;double&gt;&gt;&amp; ptxt);</div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160; </div>
<div class="line"><a name="l00591"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a437f17abc80f5401cad056aca075bf03">  591</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a437f17abc80f5401cad056aca075bf03">xorConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; poly, <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">double</span> size = -1.0)</div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;  {</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;    <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a> tmp = poly;</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    tmp *= -2;</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;    tmp += 1; <span class="comment">// tmp = 1-2*poly</span></div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(tmp);</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(poly);</div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;  }</div>
<div class="line"><a name="l00599"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a034f38f0e52a7fa7b9bd234c5ddfefdf">  599</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a034f38f0e52a7fa7b9bd234c5ddfefdf">xorConstant</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly, <span class="keywordtype">double</span> size = -1.0)</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;  {</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a437f17abc80f5401cad056aca075bf03">xorConstant</a>(<a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(poly, context, primeSet), size);</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;  }</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160; </div>
<div class="line"><a name="l00604"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a587ab9412c3344825a34ce58d0641e3d">  604</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a587ab9412c3344825a34ce58d0641e3d">nxorConstant</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>&amp; poly, <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">double</span> size = -1.0)</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;  {</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;    <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a> tmp = poly;</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;    tmp *= 2;</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    tmp -= 1;                      <span class="comment">// 2a-1</span></div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(<a class="code" href="namespacehelib.html#ac584b135744603cdff25e2db01b9463a">NTL::to_ZZX</a>(-1L)); <span class="comment">// b11</span></div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(tmp);           <span class="comment">// (b-1)(2a-1)</span></div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">addConstant</a>(poly);             <span class="comment">// (b-1)(2a-1)+a = 1-a-b+2ab</span></div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;  }</div>
<div class="line"><a name="l00613"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#aa15b7e2bfaf801a12ac9f7f2b407b7a6">  613</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#aa15b7e2bfaf801a12ac9f7f2b407b7a6">nxorConstant</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly, <span class="keywordtype">double</span> size = -1.0)</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;  {</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a587ab9412c3344825a34ce58d0641e3d">nxorConstant</a>(<a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>(poly, context, primeSet), size);</div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;  }</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160; </div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#afac2f450f59550fe5189581128a797ad">divideByP</a>();</div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160; </div>
<div class="line"><a name="l00626"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a5d7f0fe8a4c3e7b9b3298396039589cf">  626</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a5d7f0fe8a4c3e7b9b3298396039589cf">multByP</a>(<span class="keywordtype">long</span> e = 1)</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;  {</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;    <span class="keywordtype">long</span> p2e = NTL::power_long(context.<a class="code" href="classhelib_1_1_context.html#ab261446cf0a635a7bf1edf081df48d81">zMStar</a>.<a class="code" href="classhelib_1_1_p_algebra.html#a5563b7dc7f0559d779bf869fbe4b3a5f">getP</a>(), e);</div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;    ptxtSpace *= p2e;</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;    <a class="code" href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">multByConstant</a>(NTL::to_ZZ(p2e));</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;  }</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160; </div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;  <span class="comment">// For backward compatibility</span></div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#abf3fba1cfff58043e99f24889629b58b">divideBy2</a>();</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a46f673df4826eace8616c27efec22356">extractBits</a>(std::vector&lt;Ctxt&gt;&amp; bits, <span class="keywordtype">long</span> nBits2extract = 0);</div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160; </div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;  <span class="comment">// Higher-level multiply routines</span></div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a4998340ac9bb105674b4a136ef5f1eb0">multiplyBy</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other);</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a590e147aceaf3db0c4a7fdbcd870ee89">multiplyBy2</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other1, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; other2);</div>
<div class="line"><a name="l00640"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a61dba3779cdb768843fa488e94b34a46">  640</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a61dba3779cdb768843fa488e94b34a46">square</a>() { <a class="code" href="classhelib_1_1_ctxt.html#a4998340ac9bb105674b4a136ef5f1eb0">multiplyBy</a>(*<span class="keyword">this</span>); }</div>
<div class="line"><a name="l00641"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a4f62266b5308de72c99e490c601c9c61">  641</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a4f62266b5308de72c99e490c601c9c61">cube</a>() { <a class="code" href="classhelib_1_1_ctxt.html#a590e147aceaf3db0c4a7fdbcd870ee89">multiplyBy2</a>(*<span class="keyword">this</span>, *<span class="keyword">this</span>); }</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160; </div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a970768c65532546641252a07e82054e9">power</a>(<span class="keywordtype">long</span> e); <span class="comment">// in polyEval.cpp</span></div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160; </div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160; </div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160; </div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a722b57bfb66f39cc18ef78d14057ad99">reducePtxtSpace</a>(<span class="keywordtype">long</span> newPtxtSpace);</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160; </div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;  <span class="comment">// This method can be used to increase the plaintext space, but the</span></div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;  <span class="comment">// high-order digits that you get this way are noise. Do not use it</span></div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;  <span class="comment">// unless you know what you are doing.</span></div>
<div class="line"><a name="l00657"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a5f9516d718d431ff05c559b2faf53e8d">  657</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a5f9516d718d431ff05c559b2faf53e8d">hackPtxtSpace</a>(<span class="keywordtype">long</span> newPtxtSpace) { ptxtSpace = newPtxtSpace; }</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160; </div>
<div class="line"><a name="l00659"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a80d08c099a3679fbb7ec5fe854a76569">  659</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a80d08c099a3679fbb7ec5fe854a76569">bumpNoiseBound</a>(<span class="keywordtype">double</span> factor) { noiseBound *= factor; }</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160; </div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a23039f8d524eaa851f939b466fed9476">reLinearize</a>(<span class="keywordtype">long</span> keyIdx = 0);</div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;  <span class="comment">// key-switch to (1,s_i), s_i is the base key with index keyIdx</span></div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160; </div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#aae0018a9d72553cd654b650d7a725ef6">cleanUp</a>();</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;  <span class="comment">// relinearize, then reduce, then drop special primes</span></div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160; </div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;  <span class="comment">// void reduce() const;</span></div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160; </div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a0561bc0edf66d15838f9c5a05029c370">blindCtxt</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly);</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160; </div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;  NTL::xdouble <a class="code" href="classhelib_1_1_ctxt.html#a24a99574856f42a599b4d23509f2a7ff">modSwitchAddedNoiseBound</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160; </div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a70334af58d9653f4afdd4891890d4af0">modUpToSet</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s);</div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160; </div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a2f74fbde43034baef79adc4d06db363c">modDownToSet</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s);</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160; </div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#af0f744c8c78cdf34c9f40098f4085afc">bringToSet</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s);</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160; </div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;  <span class="comment">// Finding the &quot;natural&quot; state of a ciphertext</span></div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_ctxt.html#af3667914cd71100d32e806c54a882a98">naturalSize</a>() <span class="keyword">const</span>;       </div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;  <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a> <a class="code" href="classhelib_1_1_ctxt.html#a8438ce2e01ffef412729f699f37065a9">naturalPrimeSet</a>() <span class="keyword">const</span>; </div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160; </div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a3fabe23624e6c54750f068c3f1e9b490">dropSmallAndSpecialPrimes</a>();</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160; </div>
<div class="line"><a name="l00701"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a9d5d53ba7f12d893d93d3c9b46b27827">  701</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_ctxt.html#a9d5d53ba7f12d893d93d3c9b46b27827">capacity</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;    <span class="keywordflow">if</span> (noiseBound &lt;= 1.0)</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;      <span class="keywordflow">return</span> context.<a class="code" href="classhelib_1_1_context.html#a237f432913ec39edc41af03384d4475d">logOfProduct</a>(<a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>());</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;      <span class="keywordflow">return</span> context.<a class="code" href="classhelib_1_1_context.html#a237f432913ec39edc41af03384d4475d">logOfProduct</a>(<a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>()) - log(noiseBound);</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;  }</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160; </div>
<div class="line"><a name="l00710"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a5103acf634a7c78666e0c2938b6e3bbb">  710</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_ctxt.html#a5103acf634a7c78666e0c2938b6e3bbb">bitCapacity</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> long(<a class="code" href="classhelib_1_1_ctxt.html#a9d5d53ba7f12d893d93d3c9b46b27827">capacity</a>() / log(2.0)); }</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160; </div>
<div class="line"><a name="l00713"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a57e7cfb7d52bd6e850383d9a38144748">  713</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_ctxt.html#a57e7cfb7d52bd6e850383d9a38144748">logOfPrimeSet</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> context.<a class="code" href="classhelib_1_1_context.html#a237f432913ec39edc41af03384d4475d">logOfProduct</a>(<a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>()); }</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160; </div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_ctxt.html#abb35f5d35c4948bf307e0ac5d735fde6">rawModSwitch</a>(std::vector&lt;NTL::ZZX&gt;&amp; zzParts, <span class="keywordtype">long</span> toModulus) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160; </div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160;  <span class="comment">//  void computePowers(std::vector&lt;Ctxt&gt;&amp; v, long nPowers) const;</span></div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160; </div>
<div class="line"><a name="l00729"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#aaf051666c8e14f40472c563b18b32ca2">  729</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#aaf051666c8e14f40472c563b18b32ca2">evalPoly</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly);</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160; </div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160; </div>
<div class="line"><a name="l00735"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a7f4dbad8c809d781dacc912b8badcc8a">  735</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a7f4dbad8c809d781dacc912b8badcc8a">clear</a>()</div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;  { <span class="comment">// set as an empty ciphertext</span></div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;    primeSet = context.<a class="code" href="classhelib_1_1_context.html#a09e894a14a98620a7f129c992468072f">ctxtPrimes</a>;</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;    parts.<a class="code" href="classhelib_1_1_index_set.html#a8b52e2294f9cf2596d4245a24105555b">clear</a>();</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;    noiseBound = NTL::to_xdouble(0.0);</div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;  }</div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160; </div>
<div class="line"><a name="l00743"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a151d7507c39014fe92da71b22d9fdaf1">  743</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#a151d7507c39014fe92da71b22d9fdaf1">isEmpty</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (parts.size() == 0); }</div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160; </div>
<div class="line"><a name="l00746"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a86eef267960b71e6d7407cb9b485e57a">  746</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#a86eef267960b71e6d7407cb9b485e57a">inCanonicalForm</a>(<span class="keywordtype">long</span> keyID = 0)<span class="keyword"> const</span></div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;    <span class="keywordflow">if</span> (parts.size() &gt; 2)</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;    <span class="keywordflow">if</span> (parts.size() &gt; 0 &amp;&amp; !parts[0].skHandle.isOne())</div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;    <span class="keywordflow">if</span> (parts.size() &gt; 1 &amp;&amp; !parts[1].skHandle.isBase(keyID))</div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;  }</div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160; </div>
<div class="line"><a name="l00758"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ab1bef6b0f71080cf5fba23ea87490d0c">  758</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#ab1bef6b0f71080cf5fba23ea87490d0c">isCorrect</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;    NTL::ZZ q = context.<a class="code" href="classhelib_1_1_context.html#afc6a3c91d2488abe71e82849653b2c40">productOfPrimes</a>(primeSet);</div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;    <span class="keywordflow">return</span> NTL::to_xdouble(q) &gt; noiseBound * 2;</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;  }</div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160; </div>
<div class="line"><a name="l00764"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">  764</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> context; }</div>
<div class="line"><a name="l00765"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a56a77dfb30edd3f462dc078b6098957f">  765</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a56a77dfb30edd3f462dc078b6098957f">getPubKey</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> pubKey; }</div>
<div class="line"><a name="l00766"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">  766</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; <a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> primeSet; }</div>
<div class="line"><a name="l00767"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">  767</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">getPtxtSpace</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ptxtSpace; }</div>
<div class="line"><a name="l00768"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a0e02098df3239c69de18eeb18230b2d4">  768</a></span>&#160;  <span class="keyword">const</span> NTL::xdouble&amp; <a class="code" href="classhelib_1_1_ctxt.html#a0e02098df3239c69de18eeb18230b2d4">getNoiseBound</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> noiseBound; }</div>
<div class="line"><a name="l00769"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a5daa78f3a3a389ad51b86ab80c888a2b">  769</a></span>&#160;  <span class="keyword">const</span> NTL::xdouble&amp; <a class="code" href="classhelib_1_1_ctxt.html#a5daa78f3a3a389ad51b86ab80c888a2b">getRatFactor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ratFactor; }</div>
<div class="line"><a name="l00770"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a1c698a0abe3be38476a7d753f01cc2da">  770</a></span>&#160;  <span class="keyword">const</span> NTL::xdouble&amp; <a class="code" href="classhelib_1_1_ctxt.html#a1c698a0abe3be38476a7d753f01cc2da">getPtxtMag</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ptxtMag; }</div>
<div class="line"><a name="l00771"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#aa0c7680eb965e3e62138f98b18abca22">  771</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#aa0c7680eb965e3e62138f98b18abca22">setPtxtMag</a>(<span class="keyword">const</span> NTL::xdouble&amp; z) { ptxtMag = z; }</div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_ctxt.html#aae1e0cb3a33cfed57792f6045ad7c959">getKeyID</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160; </div>
<div class="line"><a name="l00774"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#ac6b93e6a7979f2d7e14022fe1ec9c384">  774</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_ctxt.html#ac6b93e6a7979f2d7e14022fe1ec9c384">isCKKS</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>().alMod.getTag() == <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee">PA_cx_tag</a>); }</div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160; </div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;  <span class="comment">// Return r such that p^r = ptxtSpace</span></div>
<div class="line"><a name="l00777"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a41b893329c70c016d9b42c558eb16b50">  777</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_ctxt.html#a41b893329c70c016d9b42c558eb16b50">effectiveR</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;    <span class="keywordtype">long</span> p = context.<a class="code" href="classhelib_1_1_context.html#ab261446cf0a635a7bf1edf081df48d81">zMStar</a>.<a class="code" href="classhelib_1_1_p_algebra.html#a5563b7dc7f0559d779bf869fbe4b3a5f">getP</a>();</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> r = 1, p2r = p; r &lt; NTL_SP_NBITS; r++, p2r *= p) {</div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;      <span class="keywordflow">if</span> (p2r == ptxtSpace)</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;        <span class="keywordflow">return</span> r;</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;      <span class="keywordflow">if</span> (p2r &gt; ptxtSpace)</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(<span class="stringliteral">&quot;ctxt.ptxtSpace is not of the form p^r&quot;</span>);</div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;    }</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(<span class="stringliteral">&quot;ctxt.ptxtSpace is not of the form p^r&quot;</span>);</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;    <span class="keywordflow">return</span> 0; <span class="comment">// just to keep the compiler happy</span></div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;  }</div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160; </div>
<div class="line"><a name="l00791"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a4062ff14de8774d02f27cae393cb08a5">  791</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_ctxt.html#a4062ff14de8774d02f27cae393cb08a5">log_of_ratio</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;    <span class="keywordtype">double</span> logNoise =</div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;        (<a class="code" href="classhelib_1_1_ctxt.html#a0e02098df3239c69de18eeb18230b2d4">getNoiseBound</a>() &lt;= 0.0) ? -DBL_MAX : log(<a class="code" href="classhelib_1_1_ctxt.html#a0e02098df3239c69de18eeb18230b2d4">getNoiseBound</a>());</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;    <span class="keywordtype">double</span> logMod =</div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;        <a class="code" href="namespacehelib.html#ad94835a294c90ee0ea0336561c8f38ad">empty</a>(<a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>()) ? -DBL_MAX : context.<a class="code" href="classhelib_1_1_context.html#a237f432913ec39edc41af03384d4475d">logOfProduct</a>(<a class="code" href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">getPrimeSet</a>());</div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;    <span class="keywordflow">return</span> logNoise - logMod;</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;  }</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;  <span class="keyword">friend</span> std::istream&amp; <a class="code" href="classhelib_1_1_ctxt.html#a965b7c23b5accbeb262bafb324632167">operator&gt;&gt;</a>(std::istream&amp; str, <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt);</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classhelib_1_1_ctxt.html#abcb6fc628bff328e4ee762f7019000e3">operator&lt;&lt;</a>(std::ostream&amp; str, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt);</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160; </div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;  <span class="comment">// Raw IO</span></div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#ac1559c3aed190d010d3687667943dbc1">write</a>(std::ostream&amp; str) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a7fa59bafd14baaf72dcdf8fe2bdd600f">read</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160; </div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;  <span class="comment">// scale up c1, c2 so they have the same ratFactor</span></div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a50433a7d94585512ad6b583a596bbad2">equalizeRationalFactors</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c1, <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c2);</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;};</div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160; </div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;<span class="comment">// set out=prod_{i=0}^{n-1} v[j], takes depth log n and n-1 products</span></div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;<span class="comment">// out could point to v[0], but having it pointing to any other v[i]</span></div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;<span class="comment">// will make the result unpredictable.</span></div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8d9530775923f034eadc4f3e80f355ff">totalProduct</a>(Ctxt&amp; out, <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v);</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160; </div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a693b16168065219388722259c6a02c5d">incrementalProduct</a>(std::vector&lt;Ctxt&gt;&amp; v);</div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160; </div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(Ctxt&amp; result,</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;                  <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;                  <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v2);</div>
<div class="line"><a name="l00823"></a><span class="lineno"><a class="line" href="namespacehelib.html#aa738424e1ab49c4f39cbcb3e3e920591">  823</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(<span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160;                         <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v2)</div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;{</div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> ret(v1[0].getPubKey());</div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;  <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(ret, v1, v2);</div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;}</div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160; </div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(Ctxt&amp; result,</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;                  <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;                  <span class="keyword">const</span> std::vector&lt;DoubleCRT&gt;&amp; v2);</div>
<div class="line"><a name="l00835"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad0d0484b1e2d0105b7a2b70a3c6dc182">  835</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(<span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;                         <span class="keyword">const</span> std::vector&lt;DoubleCRT&gt;&amp; v2)</div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160;{</div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> ret(v1[0].getPubKey());</div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;  <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(ret, v1, v2);</div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;}</div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160; </div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(Ctxt&amp; result,</div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;                  <span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;                  <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; v2);</div>
<div class="line"><a name="l00846"></a><span class="lineno"><a class="line" href="namespacehelib.html#a6d67040ef7ba12958be263a7a93dac9e">  846</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(<span class="keyword">const</span> std::vector&lt;Ctxt&gt;&amp; v1,</div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;                         <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; v2)</div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160;{</div>
<div class="line"><a name="l00849"></a><span class="lineno">  849</span>&#160;  <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a> ret(v1[0].getPubKey());</div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;  <a class="code" href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">innerProduct</a>(ret, v1, v2);</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;}</div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160; </div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a887b96d1f7918079c15b6fa1d8cbfae4">CheckCtxt</a>(<span class="keyword">const</span> Ctxt&amp; c, <span class="keyword">const</span> <span class="keywordtype">char</span>* label);</div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160; </div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a90e48196b014916b26112c02883f64e3">extractDigits</a>(std::vector&lt;Ctxt&gt;&amp; digits, <span class="keyword">const</span> Ctxt&amp; c, <span class="keywordtype">long</span> r = 0);</div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;<span class="comment">// implemented in extractDigits.cpp</span></div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160; </div>
<div class="line"><a name="l00881"></a><span class="lineno"><a class="line" href="namespacehelib.html#ab463f07c91389f56b58bb09da140230d">  881</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a90e48196b014916b26112c02883f64e3">extractDigits</a>(std::vector&lt;Ctxt&gt;&amp; digits,</div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;                          <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c,</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;                          <span class="keywordtype">long</span> r,</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;                          <span class="keywordtype">bool</span> shortCut)</div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;{</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;  <span class="keywordflow">if</span> (shortCut)</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;    std::cerr &lt;&lt; <span class="stringliteral">&quot;extractDigits: the shortCut flag is disabled\n&quot;</span>;</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;  <a class="code" href="namespacehelib.html#a90e48196b014916b26112c02883f64e3">extractDigits</a>(digits, c, r);</div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;}</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160; </div>
<div class="line"><a name="l00891"></a><span class="lineno"><a class="line" href="classhelib_1_1_ctxt.html#a46f673df4826eace8616c27efec22356">  891</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_ctxt.html#a46f673df4826eace8616c27efec22356">Ctxt::extractBits</a>(std::vector&lt;Ctxt&gt;&amp; bits, <span class="keywordtype">long</span> nBits2extract)</div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;{</div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;  <a class="code" href="namespacehelib.html#a90e48196b014916b26112c02883f64e3">extractDigits</a>(bits, *<span class="keyword">this</span>, nBits2extract);</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;}</div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160; </div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;<span class="comment">// @brief Extract the mod-p digits of a mod-p^{r+e} ciphertext.</span></div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160; </div>
<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160;<span class="comment">// extendExtractDigits assumes that the slots of *this contains integers mod</span></div>
<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;<span class="comment">// p^{r+e} i.e., that only the free terms are nonzero. (If that assumptions</span></div>
<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;<span class="comment">// does not hold then the result will not be a valid ciphertext anymore.)</span></div>
<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160;<span class="comment">// It returns in the slots of digits[j] the j&#39;th-lowest digits from the</span></div>
<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;<span class="comment">// integers in the slots of the input. Namely, the i&#39;th slot of digits[j]</span></div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;<span class="comment">// contains the j&#39;th digit in the p-base expansion of the integer in the i&#39;th</span></div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;<span class="comment">// slot of the *this.  The plaintext space of digits[j] is mod p^{e+r-j}.</span></div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160; </div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3f9b160771517accfb43d16c5590942c">extendExtractDigits</a>(std::vector&lt;Ctxt&gt;&amp; digits,</div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;                         <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c,</div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;                         <span class="keywordtype">long</span> r,</div>
<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;                         <span class="keywordtype">long</span> e);</div>
<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;<span class="comment">// implemented in extractDigits.cpp</span></div>
<div class="line"><a name="l00912"></a><span class="lineno">  912</span>&#160; </div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160; </div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_CTXT_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_ptxt_html"><div class="ttname"><a href="classhelib_1_1_ptxt.html">helib::Ptxt</a></div><div class="ttdoc">An object that mimics the functionality of the Ctxt object, and acts as a convenient entry point for ...</div><div class="ttdef"><b>Definition:</b> Ctxt.h:66</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_ac8441b0140bd6652880eb1461ebc0278"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#ac8441b0140bd6652880eb1461ebc0278">helib::SKHandle::setOne</a></div><div class="ttdeci">void setOne(long newSecretKeyID=-1)</div><div class="ttdoc">Set powerOfS=0, powerOfX=1.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:110</div></div>
<div class="ttc" id="aclasshelib_1_1_basic_automorph_precon_html"><div class="ttname"><a href="classhelib_1_1_basic_automorph_precon.html">helib::BasicAutomorphPrecon</a></div><div class="ttdoc">Pre-computation to speed many automorphism on the same ciphertext.</div><div class="ttdef"><b>Definition:</b> matmul.cpp:61</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a17f72520454a241efefa48b9132faf47"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">helib::Ctxt::getContext</a></div><div class="ttdeci">const Context &amp; getContext() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:764</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a41b893329c70c016d9b42c558eb16b50"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a41b893329c70c016d9b42c558eb16b50">helib::Ctxt::effectiveR</a></div><div class="ttdeci">long effectiveR() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:777</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_ab3db0c0376d013b4d9760f979664b199"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#ab3db0c0376d013b4d9760f979664b199">helib::SKHandle::setBase</a></div><div class="ttdeci">void setBase(long newSecretKeyID=-1)</div><div class="ttdoc">Set powerOfS=powerOfX=1.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:92</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a4062ff14de8774d02f27cae393cb08a5"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a4062ff14de8774d02f27cae393cb08a5">helib::Ctxt::log_of_ratio</a></div><div class="ttdeci">double log_of_ratio() const</div><div class="ttdoc">Returns log(noiseBound) - log(q)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:791</div></div>
<div class="ttc" id="aclasshelib_1_1_runtime_error_html"><div class="ttname"><a href="classhelib_1_1_runtime_error.html">helib::RuntimeError</a></div><div class="ttdoc">Inherits from Exception and std::runtime_error.</div><div class="ttdef"><b>Definition:</b> exceptions.h:105</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_adb900c0a87e917e75bdb04f213c8b8db"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#adb900c0a87e917e75bdb04f213c8b8db">helib::CtxtPart::CtxtPart</a></div><div class="ttdeci">CtxtPart(const Context &amp;_context, const IndexSet &amp;s, const SKHandle &amp;otherHandle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:218</div></div>
<div class="ttc" id="anamespacehelib_html_ac584b135744603cdff25e2db01b9463a"><div class="ttname"><a href="namespacehelib.html#ac584b135744603cdff25e2db01b9463a">helib::to_ZZX</a></div><div class="ttdeci">NTL::ZZX to_ZZX(const DoubleCRT &amp;d)</div><div class="ttdef"><b>Definition:</b> DoubleCRT.h:414</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_af45e7cea4c25ed6252b5695f1686ea01"><div class="ttname"><a href="classhelib_1_1_ctxt.html#af45e7cea4c25ed6252b5695f1686ea01">helib::Ctxt::frobeniusAutomorph</a></div><div class="ttdeci">void frobeniusAutomorph(long j)</div><div class="ttdoc">applies the automorphism p^j using smartAutomorphism</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1758</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_aae1e0cb3a33cfed57792f6045ad7c959"><div class="ttname"><a href="classhelib_1_1_ctxt.html#aae1e0cb3a33cfed57792f6045ad7c959">helib::Ctxt::getKeyID</a></div><div class="ttdeci">long getKeyID() const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1782</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ac38e7805aad49feadfab6044a3b83c0b"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ac38e7805aad49feadfab6044a3b83c0b">helib::Ctxt::equalsTo</a></div><div class="ttdeci">bool equalsTo(const Ctxt &amp;other, bool comparePkeys=true) const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:164</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a590e147aceaf3db0c4a7fdbcd870ee89"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a590e147aceaf3db0c4a7fdbcd870ee89">helib::Ctxt::multiplyBy2</a></div><div class="ttdeci">void multiplyBy2(const Ctxt &amp;other1, const Ctxt &amp;other2)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1385</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad69c95bea08a86cf839078e92d730a74"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad69c95bea08a86cf839078e92d730a74">helib::Ctxt::multByConstantCKKS</a></div><div class="ttdeci">void multByConstantCKKS(double x)</div><div class="ttdoc">multiply by a rational number or floating point</div><div class="ttdef"><b>Definition:</b> Ctxt.h:556</div></div>
<div class="ttc" id="anamespacehelib_html_a4d6002f36f1a61982fded09adf1331ca"><div class="ttname"><a href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">helib::zzX</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; zzX</div><div class="ttdef"><b>Definition:</b> zzX.h:24</div></div>
<div class="ttc" id="anamespacehelib_html_ad94835a294c90ee0ea0336561c8f38ad"><div class="ttname"><a href="namespacehelib.html#ad94835a294c90ee0ea0336561c8f38ad">helib::empty</a></div><div class="ttdeci">bool empty(const IndexSet &amp;s)</div><div class="ttdef"><b>Definition:</b> IndexSet.h:182</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a905000baeb7e543bcf5dfddd86165807"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a905000baeb7e543bcf5dfddd86165807">helib::SKHandle::getPowerOfX</a></div><div class="ttdeci">long getPowerOfX() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:135</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a8e117ac77007f17b33985d1b12da1ca8"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a8e117ac77007f17b33985d1b12da1ca8">helib::Ctxt::operator+=</a></div><div class="ttdeci">Ctxt &amp; operator+=(const Ctxt &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:397</div></div>
<div class="ttc" id="a_double_c_r_t_8h_html"><div class="ttname"><a href="_double_c_r_t_8h.html">DoubleCRT.h</a></div><div class="ttdoc">Integer polynomials (elements in the ring R_Q) in double-CRT form.</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_aa0c7680eb965e3e62138f98b18abca22"><div class="ttname"><a href="classhelib_1_1_ctxt.html#aa0c7680eb965e3e62138f98b18abca22">helib::Ctxt::setPtxtMag</a></div><div class="ttdeci">void setPtxtMag(const NTL::xdouble &amp;z)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:771</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a2a6c0076a639a07b64ca0836c6d2ba8f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a2a6c0076a639a07b64ca0836c6d2ba8f">helib::Ctxt::DummyEncrypt</a></div><div class="ttdeci">void DummyEncrypt(const NTL::ZZX &amp;ptxt, double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:55</div></div>
<div class="ttc" id="aclasshelib_1_1_double_c_r_t_html"><div class="ttname"><a href="classhelib_1_1_double_c_r_t.html">helib::DoubleCRT</a></div><div class="ttdoc">Implementing polynomials (elements in the ring R_Q) in double-CRT form.</div><div class="ttdef"><b>Definition:</b> DoubleCRT.h:76</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_a6cf5f4c1edebbebfabd947312781eb3a"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#a6cf5f4c1edebbebfabd947312781eb3a">helib::CtxtPart::CtxtPart</a></div><div class="ttdeci">CtxtPart(const DoubleCRT &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:225</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a0e275e190947283a1a3d4a95bd3d035f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a0e275e190947283a1a3d4a95bd3d035f">helib::Ctxt::getPrimeSet</a></div><div class="ttdeci">const IndexSet &amp; getPrimeSet() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:766</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_abcbc38129fd9f8a57a51738a4bf95497"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#abcbc38129fd9f8a57a51738a4bf95497">helib::SKHandle::isOne</a></div><div class="ttdeci">bool isOne() const</div><div class="ttdoc">Is powerOfS==0?</div><div class="ttdef"><b>Definition:</b> Ctxt.h:119</div></div>
<div class="ttc" id="aclasshelib_1_1_ptxt_html_a2856a44b1a4ed056b2ab25136572dc16"><div class="ttname"><a href="classhelib_1_1_ptxt.html#a2856a44b1a4ed056b2ab25136572dc16">helib::Ptxt::getPolyRepr</a></div><div class="ttdeci">NTL::ZZX getPolyRepr() const</div><div class="ttdoc">Converts the slot data in this to its single polynomial representation.</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad791bfc3ca7b717e5c961992e264d4ab"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad791bfc3ca7b717e5c961992e264d4ab">helib::Ctxt::operator-=</a></div><div class="ttdeci">Ctxt &amp; operator-=(const Ctxt &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:402</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ae1a8692ddc6523e41a38cbc033e0798c"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ae1a8692ddc6523e41a38cbc033e0798c">helib::Ctxt::operator&gt;&gt;=</a></div><div class="ttdeci">Ctxt &amp; operator&gt;&gt;=(long k)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:417</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_a5621f300042d99495af1a676c475d066"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#a5621f300042d99495af1a676c475d066">helib::CtxtPart::operator!=</a></div><div class="ttdeci">bool operator!=(const CtxtPart &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:209</div></div>
<div class="ttc" id="anamespacehelib_html_a887b96d1f7918079c15b6fa1d8cbfae4"><div class="ttname"><a href="namespacehelib.html#a887b96d1f7918079c15b6fa1d8cbfae4">helib::CheckCtxt</a></div><div class="ttdeci">void CheckCtxt(const Ctxt &amp;c, const char *label)</div><div class="ttdoc">print to cerr some info about ciphertext</div><div class="ttdef"><b>Definition:</b> debugging.cpp:165</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a0e02098df3239c69de18eeb18230b2d4"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a0e02098df3239c69de18eeb18230b2d4">helib::Ctxt::getNoiseBound</a></div><div class="ttdeci">const NTL::xdouble &amp; getNoiseBound() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:768</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a312b6f2468ea56f3b594bb9585d6f7eb"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a312b6f2468ea56f3b594bb9585d6f7eb">helib::Ctxt::multByConstant</a></div><div class="ttdeci">void multByConstant(const DoubleCRT &amp;dcrt, double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1516</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a23039f8d524eaa851f939b466fed9476"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a23039f8d524eaa851f939b466fed9476">helib::Ctxt::reLinearize</a></div><div class="ttdeci">void reLinearize(long keyIdx=0)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:568</div></div>
<div class="ttc" id="anamespacehelib_html_a8d9530775923f034eadc4f3e80f355ff"><div class="ttname"><a href="namespacehelib.html#a8d9530775923f034eadc4f3e80f355ff">helib::totalProduct</a></div><div class="ttdeci">void totalProduct(Ctxt &amp;out, const std::vector&lt; Ctxt &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1985</div></div>
<div class="ttc" id="anamespacehelib_html_aec77ae5fa0fd11a0a42e07fefe49b99d"><div class="ttname"><a href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">helib::assertEq</a></div><div class="ttdeci">void assertEq(const T &amp;a, const T &amp;b, const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> assertions.h:108</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a079e2d2426c5076ef1c1e52882dc7ec3"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a079e2d2426c5076ef1c1e52882dc7ec3">helib::Ctxt::multByConstantCKKS</a></div><div class="ttdeci">void multByConstantCKKS(const NTL::ZZX &amp;poly, NTL::xdouble size=NTL::xdouble(-1.0), NTL::xdouble factor=NTL::xdouble(-1.0), double roundingErr=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:570</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a24a99574856f42a599b4d23509f2a7ff"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a24a99574856f42a599b4d23509f2a7ff">helib::Ctxt::modSwitchAddedNoiseBound</a></div><div class="ttdeci">NTL::xdouble modSwitchAddedNoiseBound() const</div><div class="ttdoc">Estimate the added noise.</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1792</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a5563b7dc7f0559d779bf869fbe4b3a5f"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a5563b7dc7f0559d779bf869fbe4b3a5f">helib::PAlgebra::getP</a></div><div class="ttdeci">long getP() const</div><div class="ttdoc">Returns p.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:165</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a09d29f59ac3fa73945a16931be4f756f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a09d29f59ac3fa73945a16931be4f756f">helib::Ctxt::PubKey</a></div><div class="ttdeci">friend class PubKey</div><div class="ttdef"><b>Definition:</b> Ctxt.h:271</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a50433a7d94585512ad6b583a596bbad2"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a50433a7d94585512ad6b583a596bbad2">helib::Ctxt::equalizeRationalFactors</a></div><div class="ttdeci">static void equalizeRationalFactors(Ctxt &amp;c1, Ctxt &amp;c2)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1006</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a437f17abc80f5401cad056aca075bf03"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a437f17abc80f5401cad056aca075bf03">helib::Ctxt::xorConstant</a></div><div class="ttdeci">void xorConstant(const DoubleCRT &amp;poly, UNUSED double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:591</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a722b57bfb66f39cc18ef78d14057ad99"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a722b57bfb66f39cc18ef78d14057ad99">helib::Ctxt::reducePtxtSpace</a></div><div class="ttdeci">void reducePtxtSpace(long newPtxtSpace)</div><div class="ttdoc">Reduce plaintext space to a divisor of the original plaintext space.</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:492</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html"><div class="ttname"><a href="classhelib_1_1_key_switch.html">helib::KeySwitch</a></div><div class="ttdoc">Key-switching matrices.</div><div class="ttdef"><b>Definition:</b> keySwitching.h:87</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a8dcaea89cdce5bdc050c5327aa9394bc"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a8dcaea89cdce5bdc050c5327aa9394bc">helib::Ctxt::multByConstantCKKS</a></div><div class="ttdeci">void multByConstantCKKS(std::pair&lt; long, long &gt; num)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:561</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad761bbf3977b408b91b3e9f1f9d54243"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad761bbf3977b408b91b3e9f1f9d54243">helib::Ctxt::operator!=</a></div><div class="ttdeci">bool operator!=(const Ctxt &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:385</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html">helib::SKHandle</a></div><div class="ttdoc">A handle, describing the secret-key element that &quot;matches&quot; a part, of the form s^r(X^t).</div><div class="ttdef"><b>Definition:</b> Ctxt.h:78</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a266574a060b91f68d54771b0b083d0ac"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a266574a060b91f68d54771b0b083d0ac">helib::Ctxt::complexConj</a></div><div class="ttdeci">void complexConj()</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1688</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_afac2f450f59550fe5189581128a797ad"><div class="ttname"><a href="classhelib_1_1_ctxt.html#afac2f450f59550fe5189581128a797ad">helib::Ctxt::divideByP</a></div><div class="ttdeci">void divideByP()</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1645</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a42eabb3f49d284987f292904e347896f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a42eabb3f49d284987f292904e347896f">helib::Ctxt::operator=</a></div><div class="ttdeci">Ctxt &amp; operator=(const Ctxt &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:373</div></div>
<div class="ttc" id="anamespacehelib_html_a03f697f7ff3bbb3d9d17f75d35946991"><div class="ttname"><a href="namespacehelib.html#a03f697f7ff3bbb3d9d17f75d35946991">helib::rationalApprox</a></div><div class="ttdeci">std::pair&lt; long, long &gt; rationalApprox(double x, long denomBound=0)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1573</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ab1bef6b0f71080cf5fba23ea87490d0c"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ab1bef6b0f71080cf5fba23ea87490d0c">helib::Ctxt::isCorrect</a></div><div class="ttdeci">bool isCorrect() const</div><div class="ttdoc">Would this ciphertext be decrypted without errors?</div><div class="ttdef"><b>Definition:</b> Ctxt.h:758</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_acec01f9913e427f8231124d8514cff7b"><div class="ttname"><a href="classhelib_1_1_ctxt.html#acec01f9913e427f8231124d8514cff7b">helib::Ctxt::addConstant</a></div><div class="ttdeci">void addConstant(const DoubleCRT &amp;dcrt, double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:740</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a597ac6729760ac1d7b3adc3fc09b4d81"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a597ac6729760ac1d7b3adc3fc09b4d81">helib::SKHandle::mul</a></div><div class="ttdeci">bool mul(const SKHandle &amp;a, const SKHandle &amp;b)</div><div class="ttdoc">Computes the &quot;product&quot; of two handles.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:150</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_accbb202852a15b9c20dce44bc8943bae"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#accbb202852a15b9c20dce44bc8943bae">helib::CtxtPart::read</a></div><div class="ttdeci">void read(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1861</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html"><div class="ttname"><a href="classhelib_1_1_index_set.html">helib::IndexSet</a></div><div class="ttdoc">A dynamic set of non-negative integers.</div><div class="ttdef"><b>Definition:</b> IndexSet.h:31</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a80d08c099a3679fbb7ec5fe854a76569"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a80d08c099a3679fbb7ec5fe854a76569">helib::Ctxt::bumpNoiseBound</a></div><div class="ttdeci">void bumpNoiseBound(double factor)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:659</div></div>
<div class="ttc" id="anamespacehelib_html_a3f9b160771517accfb43d16c5590942c"><div class="ttname"><a href="namespacehelib.html#a3f9b160771517accfb43d16c5590942c">helib::extendExtractDigits</a></div><div class="ttdeci">void extendExtractDigits(std::vector&lt; Ctxt &gt; &amp;digits, const Ctxt &amp;c, long r, long e)</div><div class="ttdef"><b>Definition:</b> extractDigits.cpp:225</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html">helib::CtxtPart</a></div><div class="ttdoc">One entry in a ciphertext std::vector.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:203</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_aaf051666c8e14f40472c563b18b32ca2"><div class="ttname"><a href="classhelib_1_1_ctxt.html#aaf051666c8e14f40472c563b18b32ca2">helib::Ctxt::evalPoly</a></div><div class="ttdeci">void evalPoly(const NTL::ZZX &amp;poly)</div><div class="ttdoc">compute the power X,X^2,...,X^n</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a7f4dbad8c809d781dacc912b8badcc8a"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a7f4dbad8c809d781dacc912b8badcc8a">helib::Ctxt::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> Ctxt.h:735</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a56a77dfb30edd3f462dc078b6098957f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a56a77dfb30edd3f462dc078b6098957f">helib::Ctxt::getPubKey</a></div><div class="ttdeci">const PubKey &amp; getPubKey() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:765</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_a6b1ed726e470e3c5d87ec339d476a770"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#a6b1ed726e470e3c5d87ec339d476a770">helib::CtxtPart::skHandle</a></div><div class="ttdeci">SKHandle skHandle</div><div class="ttdoc">The handle is a public data member.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:206</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_ab476739ce019454ce6e5354c9b9c7406"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#ab476739ce019454ce6e5354c9b9c7406">helib::CtxtPart::operator==</a></div><div class="ttdeci">bool operator==(const CtxtPart &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:154</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a86eef267960b71e6d7407cb9b485e57a"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a86eef267960b71e6d7407cb9b485e57a">helib::Ctxt::inCanonicalForm</a></div><div class="ttdeci">bool inCanonicalForm(long keyID=0) const</div><div class="ttdoc">A canonical ciphertext has (at most) handles pointing to (1,s)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:746</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a57e7cfb7d52bd6e850383d9a38144748"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a57e7cfb7d52bd6e850383d9a38144748">helib::Ctxt::logOfPrimeSet</a></div><div class="ttdeci">double logOfPrimeSet() const</div><div class="ttdoc">returns the log of the prime set</div><div class="ttdef"><b>Definition:</b> Ctxt.h:713</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a5d7f0fe8a4c3e7b9b3298396039589cf"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a5d7f0fe8a4c3e7b9b3298396039589cf">helib::Ctxt::multByP</a></div><div class="ttdeci">void multByP(long e=1)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:626</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a7fa59bafd14baaf72dcdf8fe2bdd600f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a7fa59bafd14baaf72dcdf8fe2bdd600f">helib::Ctxt::read</a></div><div class="ttdeci">void read(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1837</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a8438ce2e01ffef412729f699f37065a9"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a8438ce2e01ffef412729f699f37065a9">helib::Ctxt::naturalPrimeSet</a></div><div class="ttdeci">IndexSet naturalPrimeSet() const</div><div class="ttdoc">&quot;natural size&quot; is size before squaring</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1284</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_acf3c77ac71cea4aa9dcd9a76584e3552"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#acf3c77ac71cea4aa9dcd9a76584e3552">helib::CtxtPart::write</a></div><div class="ttdeci">void write(std::ostream &amp;str) const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1855</div></div>
<div class="ttc" id="aapi_attributes_8h_html_addf5ec070e9499d36b7f2009ce736076"><div class="ttname"><a href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a></div><div class="ttdeci">#define UNUSED</div><div class="ttdef"><b>Definition:</b> apiAttributes.h:31</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a160e2585f4693920976a482f8ba4435d"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a160e2585f4693920976a482f8ba4435d">helib::Ctxt::multByConstant</a></div><div class="ttdeci">void multByConstant(const Ptxt&lt; Scheme &gt; &amp;ptxt)</div><div class="ttdoc">Multiply a BGV plaintext to this Ctxt.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:550</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_ac9ab3a9daba86ae6114c2aab1a7f9501"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#ac9ab3a9daba86ae6114c2aab1a7f9501">helib::SKHandle::getSecretKeyID</a></div><div class="ttdeci">long getSecretKeyID() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:136</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a965b7c23b5accbeb262bafb324632167"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a965b7c23b5accbeb262bafb324632167">helib::Ctxt::operator&gt;&gt;</a></div><div class="ttdeci">friend std::istream &amp; operator&gt;&gt;(std::istream &amp;str, Ctxt &amp;ctxt)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1901</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad1ae403520999ebf024a8c664e74ea41"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">helib::Ctxt::getPtxtSpace</a></div><div class="ttdeci">long getPtxtSpace() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:767</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a5fc29647d9f2c82246d6c7561b03e57c"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a5fc29647d9f2c82246d6c7561b03e57c">helib::SKHandle::SKHandle</a></div><div class="ttdeci">SKHandle(long newPowerOfS=0, long newPowerOfX=1, long newSecretKeyID=0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:84</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_aff3f98d8320f01259907d99b9d1e82b4"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#aff3f98d8320f01259907d99b9d1e82b4">helib::SKHandle::isBase</a></div><div class="ttdeci">bool isBase(long ofKeyID=0) const</div><div class="ttdoc">Is powerOfS==powerOfX==1?</div><div class="ttdef"><b>Definition:</b> Ctxt.h:101</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a08b1a6dbb1fe85b2cda29b8babba474f"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a08b1a6dbb1fe85b2cda29b8babba474f">helib::Ctxt::operator*=</a></div><div class="ttdeci">Ctxt &amp; operator*=(const Ctxt &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:411</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a587ab9412c3344825a34ce58d0641e3d"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a587ab9412c3344825a34ce58d0641e3d">helib::Ctxt::nxorConstant</a></div><div class="ttdeci">void nxorConstant(const DoubleCRT &amp;poly, UNUSED double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:604</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a61dba3779cdb768843fa488e94b34a46"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a61dba3779cdb768843fa488e94b34a46">helib::Ctxt::square</a></div><div class="ttdeci">void square()</div><div class="ttdef"><b>Definition:</b> Ctxt.h:640</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_a237f432913ec39edc41af03384d4475d"><div class="ttname"><a href="classhelib_1_1_context.html#a237f432913ec39edc41af03384d4475d">helib::Context::logOfProduct</a></div><div class="ttdeci">double logOfProduct(const IndexSet &amp;s) const</div><div class="ttdoc">Returns the natural logarithm of productOfPrimes(s)</div><div class="ttdef"><b>Definition:</b> Context.h:404</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a970768c65532546641252a07e82054e9"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a970768c65532546641252a07e82054e9">helib::Ctxt::power</a></div><div class="ttdeci">void power(long e)</div><div class="ttdoc">raise ciphertext to some power</div><div class="ttdef"><b>Definition:</b> polyEval.cpp:392</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a4998340ac9bb105674b4a136ef5f1eb0"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a4998340ac9bb105674b4a136ef5f1eb0">helib::Ctxt::multiplyBy</a></div><div class="ttdeci">void multiplyBy(const Ctxt &amp;other)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1366</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a84cb5f5d23fcb447ac18af18497570ef"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a84cb5f5d23fcb447ac18af18497570ef">helib::Ctxt::operator==</a></div><div class="ttdeci">bool operator==(const Ctxt &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:384</div></div>
<div class="ttc" id="aclasshelib_1_1_pub_key_html"><div class="ttname"><a href="classhelib_1_1_pub_key.html">helib::PubKey</a></div><div class="ttdoc">The public key.</div><div class="ttdef"><b>Definition:</b> keys.h:47</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_abf3fba1cfff58043e99f24889629b58b"><div class="ttname"><a href="classhelib_1_1_ctxt.html#abf3fba1cfff58043e99f24889629b58b">helib::Ctxt::divideBy2</a></div><div class="ttdeci">void divideBy2()</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1620</div></div>
<div class="ttc" id="anamespacehelib_html_a391719dad458fcb9560406cb565f8cbe"><div class="ttname"><a href="namespacehelib.html#a391719dad458fcb9560406cb565f8cbe">helib::innerProduct</a></div><div class="ttdeci">void innerProduct(Ctxt &amp;result, const CtPtrs &amp;v1, const CtPtrs &amp;v2)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1994</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a0d8950ecc7af034b33ac8f5a247ef5ea"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a0d8950ecc7af034b33ac8f5a247ef5ea">helib::Ctxt::negate</a></div><div class="ttdeci">void negate()</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:999</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a749c2ed9522cd1b53b46f514c441be24"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a749c2ed9522cd1b53b46f514c441be24">helib::SKHandle::operator&gt;&gt;</a></div><div class="ttdeci">friend std::istream &amp; operator&gt;&gt;(std::istream &amp;s, SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1867</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a1c60338c2ff6041ef211d16bc8fd0835"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a1c60338c2ff6041ef211d16bc8fd0835">helib::Ctxt::addConstantCKKS</a></div><div class="ttdeci">void addConstantCKKS(std::pair&lt; long, long &gt;)</div><div class="ttdoc">add a rational number in the form a/b, a,b are long</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:942</div></div>
<div class="ttc" id="anamespacehelib_html_a693b16168065219388722259c6a02c5d"><div class="ttname"><a href="namespacehelib.html#a693b16168065219388722259c6a02c5d">helib::incrementalProduct</a></div><div class="ttdeci">void incrementalProduct(std::vector&lt; Ctxt &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1950</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad7697bc94e5db93b5db7238fa6418d15"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad7697bc94e5db93b5db7238fa6418d15">helib::Ctxt::smartAutomorph</a></div><div class="ttdeci">void smartAutomorph(long k)</div><div class="ttdoc">automorphism with re-linearization</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1707</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a8b52e2294f9cf2596d4245a24105555b"><div class="ttname"><a href="classhelib_1_1_index_set.html#a8b52e2294f9cf2596d4245a24105555b">helib::IndexSet::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdoc">Set to the empty set.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:120</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a70334af58d9653f4afdd4891890d4af0"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a70334af58d9653f4afdd4891890d4af0">helib::Ctxt::modUpToSet</a></div><div class="ttdeci">void modUpToSet(const IndexSet &amp;s)</div><div class="ttdoc">Modulus-switching up (to a larger modulus). Must have primeSet &lt;= s, and s must contain either all th...</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:273</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a46f673df4826eace8616c27efec22356"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a46f673df4826eace8616c27efec22356">helib::Ctxt::extractBits</a></div><div class="ttdeci">void extractBits(std::vector&lt; Ctxt &gt; &amp;bits, long nBits2extract=0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:891</div></div>
<div class="ttc" id="aapi_attributes_8h_html"><div class="ttname"><a href="api_attributes_8h.html">apiAttributes.h</a></div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a239df9f6664d3fba45ede21182471764"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a239df9f6664d3fba45ede21182471764">helib::SKHandle::read</a></div><div class="ttdeci">void read(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:33</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_afc6a3c91d2488abe71e82849653b2c40"><div class="ttname"><a href="classhelib_1_1_context.html#afc6a3c91d2488abe71e82849653b2c40">helib::Context::productOfPrimes</a></div><div class="ttdeci">void productOfPrimes(NTL::ZZ &amp;p, const IndexSet &amp;s) const</div><div class="ttdoc">The product of all the primes in the given set.</div><div class="ttdef"><b>Definition:</b> Context.cpp:178</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_af0f744c8c78cdf34c9f40098f4085afc"><div class="ttname"><a href="classhelib_1_1_ctxt.html#af0f744c8c78cdf34c9f40098f4085afc">helib::Ctxt::bringToSet</a></div><div class="ttdeci">void bringToSet(const IndexSet &amp;s)</div><div class="ttdoc">make the primeSet equal to newPrimeSet, via modUpToSet and modDownToSet</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:300</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a0378ed181a8f8d6a31f4717db37f3912"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a0378ed181a8f8d6a31f4717db37f3912">helib::Ctxt::automorph</a></div><div class="ttdeci">void automorph(long k)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1667</div></div>
<div class="ttc" id="anamespacehelib_html_addc58993c7093dd07d98335bab200e82"><div class="ttname"><a href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">helib::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:189</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ab6d6ddcfda3e0e00c821e9c30cc933be"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ab6d6ddcfda3e0e00c821e9c30cc933be">helib::Ctxt::addCtxt</a></div><div class="ttdeci">void addCtxt(const Ctxt &amp;other, bool negative=false)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1039</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a2f74fbde43034baef79adc4d06db363c"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a2f74fbde43034baef79adc4d06db363c">helib::Ctxt::modDownToSet</a></div><div class="ttdeci">void modDownToSet(const IndexSet &amp;s)</div><div class="ttdoc">Modulus-switching down (to a smaller modulus). mod-switch down to primeSet \intersect s,...</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:322</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_a785ba237b76cfff83d8e2fd4cd656359"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#a785ba237b76cfff83d8e2fd4cd656359">helib::CtxtPart::CtxtPart</a></div><div class="ttdeci">CtxtPart(const DoubleCRT &amp;other, const SKHandle &amp;otherHandle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:230</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_ac47f7606f1c607f9505d7a7cd973f114"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#ac47f7606f1c607f9505d7a7cd973f114">helib::SKHandle::operator!=</a></div><div class="ttdeci">bool operator!=(const SKHandle &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:130</div></div>
<div class="ttc" id="anamespacehelib_html_ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee"><div class="ttname"><a href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee">helib::PA_cx_tag</a></div><div class="ttdeci">@ PA_cx_tag</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:299</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a6662c3655bc718353a84832e6c7a6a41"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a6662c3655bc718353a84832e6c7a6a41">helib::Ctxt::addConstantCKKS</a></div><div class="ttdeci">void addConstantCKKS(double x)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:515</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_abb35f5d35c4948bf307e0ac5d735fde6"><div class="ttname"><a href="classhelib_1_1_ctxt.html#abb35f5d35c4948bf307e0ac5d735fde6">helib::Ctxt::rawModSwitch</a></div><div class="ttdeci">double rawModSwitch(std::vector&lt; NTL::ZZX &gt; &amp;zzParts, long toModulus) const</div><div class="ttdoc">Special-purpose modulus-switching for bootstrapping.</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:2064</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a5daa78f3a3a389ad51b86ab80c888a2b"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a5daa78f3a3a389ad51b86ab80c888a2b">helib::Ctxt::getRatFactor</a></div><div class="ttdeci">const NTL::xdouble &amp; getRatFactor() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:769</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_afb098f38a18ec6de648acadb8265d9ba"><div class="ttname"><a href="classhelib_1_1_ctxt.html#afb098f38a18ec6de648acadb8265d9ba">helib::Ctxt::multLowLvl</a></div><div class="ttdeci">void multLowLvl(const Ctxt &amp;other, bool destructive=false)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1294</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_aa15b7e2bfaf801a12ac9f7f2b407b7a6"><div class="ttname"><a href="classhelib_1_1_ctxt.html#aa15b7e2bfaf801a12ac9f7f2b407b7a6">helib::Ctxt::nxorConstant</a></div><div class="ttdeci">void nxorConstant(const NTL::ZZX &amp;poly, double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:613</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_abcb6fc628bff328e4ee762f7019000e3"><div class="ttname"><a href="classhelib_1_1_ctxt.html#abcb6fc628bff328e4ee762f7019000e3">helib::Ctxt::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;str, const Ctxt &amp;ctxt)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1891</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a3fabe23624e6c54750f068c3f1e9b490"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a3fabe23624e6c54750f068c3f1e9b490">helib::Ctxt::dropSmallAndSpecialPrimes</a></div><div class="ttdeci">void dropSmallAndSpecialPrimes()</div><div class="ttdoc">the corresponding primeSet</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:505</div></div>
<div class="ttc" id="aclasshelib_1_1_sec_key_html"><div class="ttname"><a href="classhelib_1_1_sec_key.html">helib::SecKey</a></div><div class="ttdoc">The secret key.</div><div class="ttdef"><b>Definition:</b> keys.h:225</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html"><div class="ttname"><a href="classhelib_1_1_context.html">helib::Context</a></div><div class="ttdoc">Maintaining the parameters.</div><div class="ttdef"><b>Definition:</b> Context.h:58</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a5103acf634a7c78666e0c2938b6e3bbb"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a5103acf634a7c78666e0c2938b6e3bbb">helib::Ctxt::bitCapacity</a></div><div class="ttdeci">long bitCapacity() const</div><div class="ttdoc">the capacity in bits, returned as an integer</div><div class="ttdef"><b>Definition:</b> Ctxt.h:710</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ae1974d8eaedd9da6ef46ac38a4dbf740"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ae1974d8eaedd9da6ef46ac38a4dbf740">helib::Ctxt::addConstant</a></div><div class="ttdeci">void addConstant(const Ptxt&lt; Scheme &gt; &amp;ptxt)</div><div class="ttdoc">Add a BGV plaintext to this Ctxt.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:508</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a9755426e7ad503525a3f7ebd7fda001a"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a9755426e7ad503525a3f7ebd7fda001a">helib::Ctxt::Ctxt</a></div><div class="ttdeci">Ctxt(const Ctxt &amp;other)=default</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ac1559c3aed190d010d3687667943dbc1"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ac1559c3aed190d010d3687667943dbc1">helib::Ctxt::write</a></div><div class="ttdeci">void write(std::ostream &amp;str) const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1815</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a1c698a0abe3be38476a7d753f01cc2da"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a1c698a0abe3be38476a7d753f01cc2da">helib::Ctxt::getPtxtMag</a></div><div class="ttdeci">const NTL::xdouble &amp; getPtxtMag() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:770</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a151d7507c39014fe92da71b22d9fdaf1"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a151d7507c39014fe92da71b22d9fdaf1">helib::Ctxt::isEmpty</a></div><div class="ttdeci">bool isEmpty() const</div><div class="ttdoc">Is this an empty ciphertext without any parts.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:743</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a59ec48370cb48358715541436267182b"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a59ec48370cb48358715541436267182b">helib::SKHandle::write</a></div><div class="ttdeci">void write(std::ostream &amp;str) const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:40</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a6167385b97fec9383924ce1de0623447"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a6167385b97fec9383924ce1de0623447">helib::Ctxt::Ctxt</a></div><div class="ttdeci">Ctxt(const PubKey &amp;newPubKey, long newPtxtSpace=0)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:199</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_a0fc34851d7423c914dc3277c92631b16"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#a0fc34851d7423c914dc3277c92631b16">helib::SKHandle::getPowerOfS</a></div><div class="ttdeci">long getPowerOfS() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:134</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a034f38f0e52a7fa7b9bd234c5ddfefdf"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a034f38f0e52a7fa7b9bd234c5ddfefdf">helib::Ctxt::xorConstant</a></div><div class="ttdeci">void xorConstant(const NTL::ZZX &amp;poly, double size=-1.0)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:599</div></div>
<div class="ttc" id="anamespacehelib_html_a90e48196b014916b26112c02883f64e3"><div class="ttname"><a href="namespacehelib.html#a90e48196b014916b26112c02883f64e3">helib::extractDigits</a></div><div class="ttdeci">void extractDigits(std::vector&lt; Ctxt &gt; &amp;digits, const Ctxt &amp;c, long r=0)</div><div class="ttdoc">Extract the mod-p digits of a mod-p^r ciphertext.</div><div class="ttdef"><b>Definition:</b> extractDigits.cpp:70</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html"><div class="ttname"><a href="classhelib_1_1_ctxt.html">helib::Ctxt</a></div><div class="ttdoc">A Ctxt object holds a single ciphertext.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:270</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_part_html_a65d605d7226b0c62b404ce12a8a15a5b"><div class="ttname"><a href="classhelib_1_1_ctxt_part.html#a65d605d7226b0c62b404ce12a8a15a5b">helib::CtxtPart::CtxtPart</a></div><div class="ttdeci">CtxtPart(const Context &amp;_context, const IndexSet &amp;s)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:213</div></div>
<div class="ttc" id="anamespacehelib_html_a84b37f68c4bdc42558ad0360b00984fb"><div class="ttname"><a href="namespacehelib.html#a84b37f68c4bdc42558ad0360b00984fb">helib::operator&gt;&gt;</a></div><div class="ttdeci">std::istream &amp; operator&gt;&gt;(std::istream &amp;s, CtxtPart &amp;p)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1882</div></div>
<div class="ttc" id="anamespacehelib_html_ac1a8de3a0f340ce6a600fa1da2233191"><div class="ttname"><a href="namespacehelib.html#ac1a8de3a0f340ce6a600fa1da2233191">helib::operator+=</a></div><div class="ttdeci">zzX &amp; operator+=(zzX &amp;a, const zzX &amp;b)</div><div class="ttdef"><b>Definition:</b> zzX.h:43</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a4f62266b5308de72c99e490c601c9c61"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a4f62266b5308de72c99e490c601c9c61">helib::Ctxt::cube</a></div><div class="ttdeci">void cube()</div><div class="ttdef"><b>Definition:</b> Ctxt.h:641</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a0561bc0edf66d15838f9c5a05029c370"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a0561bc0edf66d15838f9c5a05029c370">helib::Ctxt::blindCtxt</a></div><div class="ttdeci">void blindCtxt(const NTL::ZZX &amp;poly)</div><div class="ttdoc">Add a high-noise encryption of the given constant.</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:480</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_aae0018a9d72553cd654b650d7a725ef6"><div class="ttname"><a href="classhelib_1_1_ctxt.html#aae0018a9d72553cd654b650d7a725ef6">helib::Ctxt::cleanUp</a></div><div class="ttdeci">void cleanUp()</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:628</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_a09e894a14a98620a7f129c992468072f"><div class="ttname"><a href="classhelib_1_1_context.html#a09e894a14a98620a7f129c992468072f">helib::Context::ctxtPrimes</a></div><div class="ttdeci">IndexSet ctxtPrimes</div><div class="ttdef"><b>Definition:</b> Context.h:280</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ac6b93e6a7979f2d7e14022fe1ec9c384"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ac6b93e6a7979f2d7e14022fe1ec9c384">helib::Ctxt::isCKKS</a></div><div class="ttdeci">bool isCKKS() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:774</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html_af6fe46226ec3a104b4ccbeffb421f8ae"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html#af6fe46226ec3a104b4ccbeffb421f8ae">helib::SKHandle::operator==</a></div><div class="ttdeci">bool operator==(const SKHandle &amp;other) const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:121</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_af3667914cd71100d32e806c54a882a98"><div class="ttname"><a href="classhelib_1_1_ctxt.html#af3667914cd71100d32e806c54a882a98">helib::Ctxt::naturalSize</a></div><div class="ttdeci">double naturalSize() const</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1277</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a9d5d53ba7f12d893d93d3c9b46b27827"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a9d5d53ba7f12d893d93d3c9b46b27827">helib::Ctxt::capacity</a></div><div class="ttdeci">double capacity() const</div><div class="ttdoc">returns the &quot;capacity&quot; of a ciphertext, which is the log of the ratio of the modulus to the noise bou...</div><div class="ttdef"><b>Definition:</b> Ctxt.h:701</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_ab261446cf0a635a7bf1edf081df48d81"><div class="ttname"><a href="classhelib_1_1_context.html#ab261446cf0a635a7bf1edf081df48d81">helib::Context::zMStar</a></div><div class="ttdeci">PAlgebra zMStar</div><div class="ttdoc">The structure of Zm*.</div><div class="ttdef"><b>Definition:</b> Context.h:68</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a5f9516d718d431ff05c559b2faf53e8d"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a5f9516d718d431ff05c559b2faf53e8d">helib::Ctxt::hackPtxtSpace</a></div><div class="ttdeci">void hackPtxtSpace(long newPtxtSpace)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:657</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
